package com.example.routelink.server1.controller;


import cn.hutool.json.JSONUtil;
import com.alibaba.nacos.api.annotation.NacosInjected;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;
import com.example.routelink.server1.dto.TestRes;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;

@RestController
@Slf4j
public class HomeController {

    @RequestMapping("/hello")
    @ResponseBody
    public TestRes hello(
            @RequestParam(required = false) HashMap<String, Object> param,
            @RequestBody HashMap<String, Object> param2) {
        log.info("记录日志get hello {}", JSONUtil.toJsonStr(param));
        log.info("记录日志post hello {}", JSONUtil.toJsonStr(param2));

        return TestRes.builder().address("地址地址").id(1).name("张三").build();
    }

    @RequestMapping("/")
    public String home(@RequestParam(required = false) HashMap<String, Object> param) {
        log.info("记录日志 默认 {}", JSONUtil.toJsonStr(param));
        return "home1";
    }
}
